package cg.client.gui;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * @param Diese Klasse beschreibt das erste GUI um sich beim Server anzumelden und den Spielernamen zu uebergeben.
 * @author Sebastian Salvisberg, Tim Beer
 * @version 1.0
 */

public class GUIstart extends javax.swing.JFrame {

    private String host;
    private int port;
    private String name;
    private ObjectOutputStream outstream;
    private ObjectInputStream instream;

    public ObjectInputStream getInstream() {
        return instream;
    }

    public ObjectOutputStream getOutstream() {
        return outstream;
    }

    @Override
    public String getName() {
        return this.name;
    }

    public String getHost() {
        return this.host;
    }

    public int getPort() {
        return this.port;
    }
    /**
     * Creates new form GUIstart
     */
    public GUIstart() {
        initComponents();
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPOben = new javax.swing.JPanel();
        jPBarBlau1 = new javax.swing.JPanel();
        jPBarOrange1 = new javax.swing.JPanel();
        jPanel12 = new javax.swing.JPanel();
        jPanel13 = new javax.swing.JPanel();
        jPBarGruen1 = new javax.swing.JPanel();
        jPBarGelb1 = new javax.swing.JPanel();
        jPMitte = new javax.swing.JPanel();
        jTextFieldEingabe = new javax.swing.JTextField();
        jBSpielStarten = new javax.swing.JButton();
        jLNameEingabe = new javax.swing.JLabel();
        jLHostEingabe = new javax.swing.JLabel();
        jLPortEingabe = new javax.swing.JLabel();
        jTextFieldHost = new javax.swing.JTextField();
        jTextFieldPort = new javax.swing.JTextField();
        jBBeenden = new javax.swing.JButton();
        jLTitel = new javax.swing.JLabel();
        jPUnten = new javax.swing.JPanel();
        jLCopyright = new javax.swing.JLabel();
        jPBarGelb2 = new javax.swing.JPanel();
        jPBarBlau2 = new javax.swing.JPanel();
        jPBarGruen2 = new javax.swing.JPanel();
        jPBarOrange2 = new javax.swing.JPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("COLORETTO - START");
        setBackground(new java.awt.Color(255, 255, 255));

        jPOben.setBackground(new java.awt.Color(255, 255, 255));
        jPOben.setForeground(new java.awt.Color(51, 204, 0));

        jPBarBlau1.setBackground(new java.awt.Color(102, 102, 255));

        javax.swing.GroupLayout jPBarBlau1Layout = new javax.swing.GroupLayout(jPBarBlau1);
        jPBarBlau1.setLayout(jPBarBlau1Layout);
        jPBarBlau1Layout.setHorizontalGroup(
            jPBarBlau1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        jPBarBlau1Layout.setVerticalGroup(
            jPBarBlau1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 16, Short.MAX_VALUE)
        );

        jPBarOrange1.setBackground(new java.awt.Color(255, 102, 0));

        javax.swing.GroupLayout jPBarOrange1Layout = new javax.swing.GroupLayout(jPBarOrange1);
        jPBarOrange1.setLayout(jPBarOrange1Layout);
        jPBarOrange1Layout.setHorizontalGroup(
            jPBarOrange1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        jPBarOrange1Layout.setVerticalGroup(
            jPBarOrange1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 17, Short.MAX_VALUE)
        );

        jPanel12.setBackground(new java.awt.Color(204, 204, 0));

        javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
        jPanel12.setLayout(jPanel12Layout);
        jPanel12Layout.setHorizontalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 110, Short.MAX_VALUE)
        );
        jPanel12Layout.setVerticalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        jPanel13.setBackground(new java.awt.Color(204, 204, 0));

        javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13);
        jPanel13.setLayout(jPanel13Layout);
        jPanel13Layout.setHorizontalGroup(
            jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 256, Short.MAX_VALUE)
        );
        jPanel13Layout.setVerticalGroup(
            jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );

        jPBarGruen1.setBackground(new java.awt.Color(0, 204, 0));

        javax.swing.GroupLayout jPBarGruen1Layout = new javax.swing.GroupLayout(jPBarGruen1);
        jPBarGruen1.setLayout(jPBarGruen1Layout);
        jPBarGruen1Layout.setHorizontalGroup(
            jPBarGruen1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        jPBarGruen1Layout.setVerticalGroup(
            jPBarGruen1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 17, Short.MAX_VALUE)
        );

        jPBarGelb1.setBackground(new java.awt.Color(255, 255, 0));

        javax.swing.GroupLayout jPBarGelb1Layout = new javax.swing.GroupLayout(jPBarGelb1);
        jPBarGelb1.setLayout(jPBarGelb1Layout);
        jPBarGelb1Layout.setHorizontalGroup(
            jPBarGelb1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        jPBarGelb1Layout.setVerticalGroup(
            jPBarGelb1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 17, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout jPObenLayout = new javax.swing.GroupLayout(jPOben);
        jPOben.setLayout(jPObenLayout);
        jPObenLayout.setHorizontalGroup(
            jPObenLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPBarBlau1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(jPObenLayout.createSequentialGroup()
                .addGap(77, 77, 77)
                .addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(180, 180, 180)
                .addComponent(jPanel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(117, 117, 117))
            .addComponent(jPBarOrange1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPBarGelb1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPBarGruen1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jPObenLayout.setVerticalGroup(
            jPObenLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPObenLayout.createSequentialGroup()
                .addGap(25, 25, 25)
                .addComponent(jPBarGelb1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPBarBlau1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPBarGruen1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(5, 5, 5)
                .addComponent(jPBarOrange1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPObenLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );

        jBSpielStarten.setText("Spiel starten");
        jBSpielStarten.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBSpielStartenActionPerformed(evt);
            }
        });

        jLNameEingabe.setText("Name:");

        jLHostEingabe.setText("Host:");

        jLPortEingabe.setText("Port:");

        jTextFieldHost.setText("timbeer.dyndns.org");

        jTextFieldPort.setText("7777");

        jBBeenden.setText("Beenden");
        jBBeenden.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBBeendenActionPerformed(evt);
            }
        });

        jLTitel.setFont(new java.awt.Font("Tahoma", 0, 33)); // NOI18N
        jLTitel.setForeground(new java.awt.Color(102, 102, 102));
        jLTitel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLTitel.setText("COLORETTO");

        javax.swing.GroupLayout jPMitteLayout = new javax.swing.GroupLayout(jPMitte);
        jPMitte.setLayout(jPMitteLayout);
        jPMitteLayout.setHorizontalGroup(
            jPMitteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPMitteLayout.createSequentialGroup()
                .addGroup(jPMitteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPMitteLayout.createSequentialGroup()
                        .addGap(221, 221, 221)
                        .addGroup(jPMitteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPMitteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addGroup(jPMitteLayout.createSequentialGroup()
                                    .addGroup(jPMitteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLHostEingabe)
                                        .addComponent(jLPortEingabe))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addGroup(jPMitteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jTextFieldHost)
                                        .addComponent(jTextFieldPort, javax.swing.GroupLayout.PREFERRED_SIZE, 193, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGroup(jPMitteLayout.createSequentialGroup()
                                    .addComponent(jLNameEingabe)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jTextFieldEingabe, javax.swing.GroupLayout.PREFERRED_SIZE, 192, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(jPMitteLayout.createSequentialGroup()
                                .addComponent(jBSpielStarten)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jBBeenden, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(jPMitteLayout.createSequentialGroup()
                        .addGap(259, 259, 259)
                        .addComponent(jLTitel, javax.swing.GroupLayout.PREFERRED_SIZE, 192, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPMitteLayout.setVerticalGroup(
            jPMitteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPMitteLayout.createSequentialGroup()
                .addGap(15, 15, 15)
                .addComponent(jLTitel, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(22, 22, 22)
                .addGroup(jPMitteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextFieldEingabe, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLNameEingabe))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPMitteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLHostEingabe)
                    .addComponent(jTextFieldHost, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPMitteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextFieldPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLPortEingabe))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPMitteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jBSpielStarten)
                    .addComponent(jBBeenden))
                .addGap(16, 16, 16))
        );

        jPUnten.setBackground(new java.awt.Color(255, 255, 255));

        jLCopyright.setFont(new java.awt.Font("Tahoma", 0, 8)); // NOI18N
        jLCopyright.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLCopyright.setText("© Copyright by Tim Beer, Yanick Belart, Christian Friedli, Sebastian Salvisberg ");

        jPBarGelb2.setBackground(new java.awt.Color(255, 255, 0));

        javax.swing.GroupLayout jPBarGelb2Layout = new javax.swing.GroupLayout(jPBarGelb2);
        jPBarGelb2.setLayout(jPBarGelb2Layout);
        jPBarGelb2Layout.setHorizontalGroup(
            jPBarGelb2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        jPBarGelb2Layout.setVerticalGroup(
            jPBarGelb2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 17, Short.MAX_VALUE)
        );

        jPBarBlau2.setBackground(new java.awt.Color(102, 102, 255));

        javax.swing.GroupLayout jPBarBlau2Layout = new javax.swing.GroupLayout(jPBarBlau2);
        jPBarBlau2.setLayout(jPBarBlau2Layout);
        jPBarBlau2Layout.setHorizontalGroup(
            jPBarBlau2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        jPBarBlau2Layout.setVerticalGroup(
            jPBarBlau2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 16, Short.MAX_VALUE)
        );

        jPBarGruen2.setBackground(new java.awt.Color(0, 204, 0));

        javax.swing.GroupLayout jPBarGruen2Layout = new javax.swing.GroupLayout(jPBarGruen2);
        jPBarGruen2.setLayout(jPBarGruen2Layout);
        jPBarGruen2Layout.setHorizontalGroup(
            jPBarGruen2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        jPBarGruen2Layout.setVerticalGroup(
            jPBarGruen2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 17, Short.MAX_VALUE)
        );

        jPBarOrange2.setBackground(new java.awt.Color(255, 102, 0));

        javax.swing.GroupLayout jPBarOrange2Layout = new javax.swing.GroupLayout(jPBarOrange2);
        jPBarOrange2.setLayout(jPBarOrange2Layout);
        jPBarOrange2Layout.setHorizontalGroup(
            jPBarOrange2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        jPBarOrange2Layout.setVerticalGroup(
            jPBarOrange2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 17, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout jPUntenLayout = new javax.swing.GroupLayout(jPUnten);
        jPUnten.setLayout(jPUntenLayout);
        jPUntenLayout.setHorizontalGroup(
            jPUntenLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPBarOrange2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPBarGruen2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPBarBlau2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPBarGelb2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jLCopyright, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jPUntenLayout.setVerticalGroup(
            jPUntenLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPUntenLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPBarOrange2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPBarGruen2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPBarBlau2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPBarGelb2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 43, Short.MAX_VALUE)
                .addComponent(jLCopyright, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPUnten, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPOben, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPMitte, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPOben, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPMitte, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(1, 1, 1)
                .addComponent(jPUnten, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jBSpielStartenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBSpielStartenActionPerformed
        try {
            name = jTextFieldEingabe.getText();
            host = jTextFieldHost.getText();
            String portString = jTextFieldPort.getText();
            port = Integer.parseInt(portString);

            Socket s = new Socket(host, port);
            outstream = new ObjectOutputStream(s.getOutputStream());
            instream = new ObjectInputStream(s.getInputStream());

            outstream.writeObject(name);
            
            this.setVisible(false);
        } catch (UnknownHostException ex) {
            Logger.getLogger(GUIstart.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(GUIstart.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_jBSpielStartenActionPerformed

    private void jBBeendenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBBeendenActionPerformed
        System.exit(0);
    }//GEN-LAST:event_jBBeendenActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jBBeenden;
    public javax.swing.JButton jBSpielStarten;
    private javax.swing.JLabel jLCopyright;
    private javax.swing.JLabel jLHostEingabe;
    private javax.swing.JLabel jLNameEingabe;
    private javax.swing.JLabel jLPortEingabe;
    private javax.swing.JLabel jLTitel;
    private javax.swing.JPanel jPBarBlau1;
    private javax.swing.JPanel jPBarBlau2;
    private javax.swing.JPanel jPBarGelb1;
    private javax.swing.JPanel jPBarGelb2;
    private javax.swing.JPanel jPBarGruen1;
    private javax.swing.JPanel jPBarGruen2;
    private javax.swing.JPanel jPBarOrange1;
    private javax.swing.JPanel jPBarOrange2;
    private javax.swing.JPanel jPMitte;
    private javax.swing.JPanel jPOben;
    private javax.swing.JPanel jPUnten;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel13;
    public javax.swing.JTextField jTextFieldEingabe;
    private javax.swing.JTextField jTextFieldHost;
    private javax.swing.JTextField jTextFieldPort;
    // End of variables declaration//GEN-END:variables
}
